After Not Doing Something by Ron Newcomb

Version 2

"Allows us to write rules that happen after an action fails, such as 'After not examining or searching something'"
Jump to extension code
Jump to "I Try, and I Try" example
Copy Include After Not Doing Something by Ron Newcomb to clipboard Include After Not Doing Something by Ron Newcomb.
Inform has always allowed us to write rules which take place after a character has done something.

After doing something to the fragile wineglass, say "Careful, that's real crystal."

But Inform doesn't allow us the same flexibility if whatever action we were attempting failed. This extension addresses this by allowing us to write "after not" rules.

After not taking or climbing something, say "Maybe if you washed the butter off your fingers?"

Just like the After and Instead rules, the After Not rules will only run the single most applicable rule, unless of course that rule ends with "make no decision".


Example: * I Try, and I Try - Some people are never happy.

Copy "I Try, and I Try" to clipboard

Play "I Try, and I Try"

test me I Try, and I Try
An Interactive Fiction
Release 1 / Serial number 220517 / Inform 7 build 6M62 (I6/v6.36 lib 6/12N) SD

Your parent's house
You can see your disapproving mother and a TV here.

>test me
(Testing.)

>[1] go outside
You can't go that way.

In the background, you hear your mother sigh. "Oh if you'd only worked harder, going outside wouldn't be a problem now, would it?"

>[2] turn on tv
It isn't something you can switch.

In the background, you hear your mother sigh. "Oh if you'd only worked harder, switching on the TV wouldn't be a problem now, would it?"

>[3] dust tv
You rub the TV.

>[4] push tv
It is fixed in place.

Your mother sighs. "Here, *I'll* get it for you."

>[5] nap
You aren't feeling especially drowsy.

In the background, you hear your mother sigh. "Oh if you'd only worked harder, sleeping wouldn't be a problem now, would it?"

"I Try, and I Try"

Include after not doing something by Ron Newcomb.

Your parent's house is a room. Your disapproving mother is a woman, here. A TV is fixed in place, here.

After not doing something, say "In the background, you hear your mother sigh. 'Oh if you'd only worked harder, [the current action] wouldn't be a problem now, would it?'"

After not pushing or rubbing something, say "Your mother sighs. 'Here, *I'll* get it for you.'"

Test me with "go outside / turn on TV / dust TV / push TV / nap".
Version 2 of After Not Doing Something by Ron Newcomb begins here.

"Allows us to write rules that happen after an action fails, such as 'After not examining or searching something'"

The after not rules are an action based rulebook.
The after not rules have default success.

Include (-
[ BeginAction a n s moi notrack rv previous_actor;
    ChronologyPoint();

    @push action; @push noun; @push second; @push self; @push multiple_object_item;

    action = a; noun = n; second = s; self = noun; multiple_object_item = moi;
    if (action < 4096) {
     previous_actor = actor;
     rv = ActionPrimitive();
     if (rv == false && RulebookFailed()) {
       actor = previous_actor;
       FollowRulebook((+ the after not rules +));
     }
    }

    @pull multiple_object_item; @pull self; @pull second; @pull noun; @pull action;

    if (notrack == false) TrackActions(true, meta);
    return rv;
];
-). Include (- -) instead of "Begin Action" in "Actions.i6t". [ rulechange_sp isn't declared until later ]

After Not Doing Something ends here.